package com.bw.controller;

import com.alibaba.fastjson2.JSONObject;
import com.bw.service.EduService;
import com.mysql.cj.xdevapi.JsonArray;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
public class EduController {

    @Autowired
    EduService eduService;

    @RequestMapping("/get3")
    public JSONObject get3(){
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("status",0);
        jsonObject.put("msg","");
        List<Map> list = eduService.get3();
        for (Map map : list) {
            jsonObject.put("data",map.get("num"));
        }
        return jsonObject;
    }


    @RequestMapping("/get4")
    public JSONObject get4(){
        JSONObject jsonObject1 = new JSONObject();
        jsonObject1.put("status",0);
        jsonObject1.put("msg","");

        JSONObject jsonObject2 = new JSONObject();

        JsonArray columns = new JsonArray();
        jsonObject2.put("columns",columns);




        JsonArray rows = new JsonArray();
        jsonObject2.put("rows",rows);

        jsonObject1.put("data",jsonObject2);
        return jsonObject1;
    }
}
